package com.xxh.annoLog;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

/**
 * 打上 @Aspect  注解，说明它是一个切面
 */
@Aspect
public class AnnocationPointCut {
    @Before("execution(* com.xxh.serviceImpl.*.*(..))")
    public void before(){
        System.out.println("=============这是方法执行之前的日志==========");
    }

    @After("execution(* com.xxh.serviceImpl.*.*(..))")
    public void after(){
        System.out.println("===========这是方法执行之后的日志============");
    }

    @Around("execution(* com.xxh.serviceImpl.UserServiceImpl.*(..))")
    public void aroundTest(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("环绕前");
        //执行方法
        joinPoint.proceed();
        System.out.println("环绕后");
    }
}
